Skip to content

Conversation

@mkilchhofer
Copy link
Contributor

@mkilchhofer mkilchhofer commented Oct 22, 2025

Rollback Plan

Simply revert the commit, there are no schema changes.

Changes to Security Controls

None

Description

It seems that you check for metadata recompute too early. The version of the state and the plan matches already and thus the helper function func recomputeMetadata(plan HelmReleaseModel, state *HelmReleaseModel) bool { } is not able to resolve the version update of the chart in all cases we evauluate in the lines below.

By moving the whole block to the end, it seems that the plan is updated for several version update cases.

Acceptance tests

  • Have you added an acceptance test for the functionality being added?
$ kind get clusters
testing

$ kubectl get nodes
NAME                         STATUS   ROLES           AGE   VERSION
testing-control-plane        Ready    control-plane   14d   v1.34.0

$ make testacc
...
ok  	github.com/hashicorp/terraform-provider-helm/helm	389.272s

Plus manual testing:

Before:

$ terraform plan
helm_release.my_local_chart: Refreshing state... [id=my-local-chart]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # helm_release.my_local_chart will be updated in-place
  ~ resource "helm_release" "my_local_chart" {
        id                         = "my-local-chart"
        name                       = "my-local-chart"
      ~ version                    = "1.10.16" -> "1.10.17"
        # (26 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

After:

$ TF_REATTACH_PROVIDERS='{"registry.terraform.io/hashicorp/helm":{"Protocol":"grpc","ProtocolVersion":6,"Pid":60272,"Test":true,"Addr":{"Network":"unix","String":"/var/folders/8q/8b5t1wjn0sggk1vrzb82t7tw0000gn/T/plugin1683805268"}}}' terraform plan
helm_release.my_local_chart: Refreshing state... [id=my-local-chart]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # helm_release.my_local_chart will be updated in-place
  ~ resource "helm_release" "my_local_chart" {
      ~ id                         = "my-local-chart" -> (known after apply)
      ~ metadata                   = {
          + app_version    = (known after apply)
          ~ chart          = "my-local-chart" -> (known after apply)
          ~ first_deployed = 1761168691 -> (known after apply)
          ~ last_deployed  = 1761175638 -> (known after apply)
          ~ name           = "my-local-chart" -> (known after apply)
          ~ namespace      = "testing" -> (known after apply)
          + notes          = (known after apply)
          ~ revision       = 16 -> (known after apply)
          ~ values         = jsonencode({}) -> (known after apply)
          ~ version        = "1.10.16" -> (known after apply)
        } -> (known after apply)
        name                       = "my-local-chart"
      + take_ownership             = false
      + upgrade_install            = false
      ~ version                    = "1.10.16" -> "1.10.17"
        # (25 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Release Note

Release note for CHANGELOG:

Address "inconsistent result after apply" error by moving recomputeMetadata() function

References

Fixes #1664
Fixes #1692

Related to:

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

@mkilchhofer mkilchhofer changed the title fix: Recompute metadata at the end of the diff function fix: Address "inconsistent result after apply" error by moving metadata recalc Oct 22, 2025
@mkilchhofer mkilchhofer marked this pull request as ready for review October 23, 2025 06:25
@mkilchhofer mkilchhofer requested a review from a team as a code owner October 23, 2025 06:25
@mkilchhofer
Copy link
Contributor Author

friendly reminder @jrhouston @BBBmau :)

@mkilchhofer
Copy link
Contributor Author

Also ping @JaylonmcShan03 since you migrated the provider from SDKv2 to plugin framework :)

@jaylonmcshan19-x
Copy link
Collaborator

Hi @mkilchhofer thank you for the contribution! I will check it out first thing tomorrow morning :)

@jaylonmcshan19-x
Copy link
Collaborator

jaylonmcshan19-x commented Nov 5, 2025

Hi @mkilchhofer just checked out your PR and everything looks good! One last request, can you please add a change log entry.

@mkilchhofer mkilchhofer force-pushed the bugfix/1664_inconsistent_result branch from 568a5d4 to f4c6e70 Compare November 5, 2025 16:00
@mkilchhofer
Copy link
Contributor Author

Hi @mkilchhofer just checked out your PR and everything looks good! One last request, can you please add a change log entry.

Hi @jaylonmcshan19-x Thanks for your review. I rebased on latest main and added the requested changelog entry as well 🙏

@jaylonmcshan19-x jaylonmcshan19-x merged commit b6a090b into hashicorp:main Nov 6, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants